<template>
  <div class="pade">
    <klist  v-if="goodsList.length===0"></klist>
    <goback class="fanhui"></goback>
    <header class="header1" v-if="goodsList.length!=0">
      <div action="#">
        <input type="text" placeholder="请输入关键字"/>
        <span class="ss iconfont icon-sousuo"></span>
      </div>
    </header>

    <nav class="navber" v-if="goodsList.length!=0">
      <ul class="clearfix">
        <li v-for="item in list" :key="item">
          <a href="#">{{item}}</a>
        </li>
      </ul>
    </nav>

    <div class="recommend1-bottom" @click="todetail(index)" v-for="(item,index) in goodsList" :key="item.id">
      <div class="r-Bbox">
        <img :src="$pre+item.img"/>
        <div class="bbox-text">
          <h3>{{item.goodsname}}</h3>
          <span>
            &yen;{{item.price}}
            <i>&yen;{{item.market_price}}</i>
          </span>
          <p>双11.11特惠</p>
          <div>
            <i>100%好评</i>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import goback from '../../components/goback.vue';
import { reqList } from '../../http/api';
import klist from "./klist.vue"
export default {
  components: { goback ,klist},
  data() {
    return {
      list: ["综合排序", "销量", "价格", "好评度", "店铺" ,"筛选"],
      goodsList:[]
    };
  },
  methods:{
    todetail(index){
      // console.log(this.goodsList[index].id);
      this.$router.push('/detail/'+this.goodsList[index].id)
    }
  },
   mounted() {
   reqList({ 
     cateid:this.$route.query.id,
        type:1
        }).then(res=>{
      this.goodsList=res.data.list.goodData?res.data.list.goodData:[]
    })
  },
  
};
</script>

<style scoped>
.header1 {
  background-image: linear-gradient(180deg, #ff6040, #ff7b68);
  padding: 0.2rem 0.24rem 0.17rem 0.26rem;
}
div {
  position: relative;
}
div input {
  width: 6.7rem;
  height: 0.6rem;
  border: 0.02rem solid #e6e6e6;
  background: #ffffff;
  text-indent: 0.67rem;
  border-radius: 0.05rem;
  font: 0.27rem/0.6rem "微软雅黑";
  color: #999999;
}
div .ss {
  position: absolute;
  left: 0.14rem;
  top: 0.15rem;
  color: #9a9a9a;
}
.header1 div {
  position: relative;
}
.navber {
  display: flex;
  overflow: hidden;
  box-shadow: 0 0.1rem 0.1rem #ffdbd3;
  background-image: linear-gradient(180deg, #ff7b69, #ff897e);
}
.navber > ul {
  flex-grow: 1;
  padding-bottom: 0.3rem;
}
.navber > ul li {
  float: left;
  margin: 0.3rem 0.3rem 0 0.19rem;
}
.navber > ul li a {
  display: block;
  font: 0.27rem "微软雅黑";
  color: #fff;
}
.recommend1-bottom {
  margin: 0.2rem;
}
.r-Bbox {
  display: flex;
  height: 2.5rem;
}
.r-Bbox img {
  margin: 0.2rem;
  width: 2rem;
  height: 2rem;
}
.bbox-text {
  margin: 0.3rem;
  display: flex;
  flex-direction: column;
  font-size: 0.25rem;
}
.bbox-text span {
  margin: 0.2rem 0;
}
.bbox-text span:nth-child(2) {
  margin-bottom: 0;
  color: red;
}
.bbox-text span:nth-child(2) i {
  color: #cccccc;
  text-decoration: line-through;
}
p{
  margin: 0.3rem 0;
  background-color: #ff6040;
  width: 80px;
  height: 20px;
  color: #fff;padding-top: .03rem;
}
</style>